#include <iostream>
#include <vector>
#include <stdint.h>

typedef std::vector<uint32_t> Array;

uint32_t TotalLength(uint16_t binary, const Array& weight)
{
	uint32_t total = 0;

	for (uint16_t bit = 0; binary; ++bit)
	{
		if (binary & 0x1)
			total += weight[bit];
		binary >>= 1;
	}

	return total;
}

const Array& ListEachCase(const Array& sticks)
{
	static Array cases;
	cases.clear();

	uint16_t size = (1 << sticks.size());

	for (uint16_t i = 0; i != size; ++i)
	{
		cases.push_back(TotalLength(i, sticks));
	}

	return cases;
}

uint32_t Find2Largest(const Array& array)
{
	uint32_t largest = 0;

	for (uint16_t i = 0; i != array.size(); ++i)
	{
		for (uint16_t j = i + 1; j < array.size(); ++j)
		{
			if (!(i & j) && array[i] == array[j] && array[i] > largest)
				largest = array[i];
		}
	}
	
	return largest;
}

int main()
{
	uint32_t n;
	std::cin >> n;

	Array sticks;
	uint32_t input;

	for (unsigned i = 0; i != n; ++i)
	{
		std::cin >> input;
		sticks.push_back(input);
	}

	const Array& each_case = ListEachCase(sticks);

	uint32_t largest = Find2Largest(each_case);

	std::cout << largest;

	return 0;
}